package com.ch.redisdemo.service;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @author CH
 * @data 2021/12/24
 */
@Service
public class RedisServiceImpl implements RedisService{
    @Resource
    private RedisTemplate<String, Object> redisTemplate;

    @Override
    public void set(String key, Object value) {
        redisTemplate.opsForValue().set(key,value,1, TimeUnit.HOURS);
    }
}
